package com.yy.satokenapplication.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.yy.satokenapplication.exception.GlobalExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/api/user")
public class UserController {
    
    @GetMapping("/list")
    @SaCheckPermission("system:user:query")
    public GlobalExceptionHandler.Result list() {
        log.info("查询用户列表");
        return GlobalExceptionHandler.Result.success("查询用户列表");
    }
    
    @PostMapping("/add")
    @SaCheckPermission("system:user:add")
    public String add() {
        log.info("新增用户");
        return "新增用户";
    }
    
    @PutMapping("/edit")
    @SaCheckPermission("system:user:edit")
    public String edit() {
        log.info("修改用户");        
        return "修改用户";
    }
    
    @DeleteMapping("/delete")
    @SaCheckRole("ROLE_ADMIN")
    @SaCheckPermission("system:user:delete")
    public String delete() {
        log.info("删除用户");
        return "删除用户";
    }
} 